home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / Examples / Text / Textension / Include / RunsRanges.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-21  |  1.9 KB  |  83 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        RunsRanges.h
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Written by:    Essam Zaky
  7.  
  8.     Copyright:    © 1994 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <2>      1/4/94    EZ        clean up
  13.          <1>      1/4/94    EZ        first checked in
  14.  
  15. */
  16.  
  17. #ifndef _Runs_
  18. #define _Runs_
  19.  
  20. #ifndef _ToolBoxDump_
  21. #include "ToolBoxDump.h"
  22. #endif
  23.  
  24. #ifndef _TextensionCommon_
  25. #include "TextensionCommon.h"
  26. #endif
  27.  
  28. #ifndef _Array_
  29. #include "Array.h"
  30. #endif
  31.  
  32. #ifndef _RunObject_
  33. #include "RunObject.h"
  34. #endif
  35.  
  36. #ifndef _ObjectsRanges_
  37. #include "ObjectsRanges.h"
  38. #endif
  39. //***************************************************************************************************
  40.  
  41.  
  42. class    CRunsRanges    :    public CObjectsRanges {
  43. public:
  44.     CRunsRanges();
  45.     
  46.     void IRunsRanges(CAttrObject* protoObj, TSize sizeInfo = kLargeSize);
  47.     
  48.     inline short GetNextRun(long offset, CRunObject** theRun, long* runLen) const
  49.         {return this->GetNextObjectRange(offset, (CAttrObject**)theRun, runLen);}
  50.     // returns the run index, -1 if no next
  51.  
  52.     char    GetScriptRange(TOffset charOffset, long *startOffset, long    *countChars) const;
  53.     //return theScript
  54.  
  55.     CRunObject* Char2TextRun(TOffset charOffset) const;
  56.     /*
  57.     -returns the nearest run to "charOffset" having text class type.
  58.     -returns nil if no such run
  59.     */
  60.     
  61.     CRunObject* Char2ScriptRun(TOffset charOffset, char theScript) const;
  62.     /*
  63.     -returns the nearest run to "charOffset" having the script "theScript".
  64.     -returns nil if no such run
  65.     */
  66.         
  67. protected:
  68.     
  69. private:
  70.     CRunObject* IsSameScript(short runIndex, char theScript) const;
  71.     
  72.     CRunObject* IsTextRun(short runIndex) const;
  73.     
  74.     CRunObject* SearchScriptBackward(short runIndex, char theScript) const;
  75.     CRunObject* SearchScriptForward(short runIndex, char theScript) const;
  76.  
  77.     CRunObject* SearchTextRunBackward(short runIndex) const;
  78.     CRunObject* SearchTextRunForward(short runIndex) const;
  79. };
  80. //**************************************************************************************************
  81.  
  82. #endif
  83.